package org.hiberlyzer.example;

import org.hibernate.Session;

public class SampleData
{
	public void saveData(Session session)
	{
		session.save(makeAlbum("Dark Side of the Moon", "Pink Floyd", "1973",
				new Track("Speak to Me/Breathe in the air", "3:57"),
				new Track("On the Run", "3:31"),
				new Track("Time", "7:05"),
				new Track("The Great Gig in the Sky", "4:47"),
				new Track("Money", "6:23"),
				new Track("Us and Them", "7:48"),
				new Track("Any Colour You Like", "3:25"),
				new Track("Brain Damage", "3:50"),
				new Track("Eclipse", "2:06")));
		
		session.save(makeAlbum("Achtung Baby", "U2", "1991",
				new Track("Zoo Station", "4:36"),
				new Track("Even Better Than the Real Thing", "3:41"),
				new Track("One", "4:36"),
				new Track("Until the End of the World", "4:39"),
				new Track("Who's Gonna Ride Your Wild Horses", "5:16"),
				new Track("So Cruel", "5:49"),
				new Track("The Fly", "4:29"),
				new Track("Mysterious Ways", "4:04"),
				new Track("Tryin' to Throw Your Arms Around the World", "3:53"),
				new Track("Ultra Violet", "5:31"),
				new Track("Acrobat", "4:30"),
				new Track("Love is Blindness", "4:23")));
		
		session.save(makeAlbum("Master of Puppets", "Metallica", "1986",
				new Track("Battery", "5:10"),
				new Track("Master of Puppets", "8:38"),
				new Track("The Thing That Should Not Be", "6:32"),
				new Track("Welcome Home (Sanitarium)", "6:28"),
				new Track("Disposable Heroes", "8:14"),
				new Track("Leper Messiah", "5:38"),
				new Track("Orion (Instrumental)", "8:12"),
				new Track("Damage, Inc.", "5:08")));
	}
	
	private Album makeAlbum(String title, String artist, String yearReleased, Track...tracks)
	{
		Album album = new Album(new Artist(artist), title, yearReleased);
		for(Track track : tracks)
		{
			album.addTrack(track);
		}
		return album;
	}
}
